#include "head_2.h"

int msgid;

void get_queue_id(){

	
	key_t key;
	
	key = ftok("/app",'g');
	
	if(key < 0){
		perror("fail to ftok");
		exit(1);
	}
	
	msgid = msgget(key,IPC_CREAT|IPC_EXCL|0777);
	
	if(msgid < 0)
	{
		if(errno == EEXIST)
		{
			msgid = msgget(key,0777);
		}else
		{
			perror("fail to msgget");
			exit(1);
		}
	}
}
